import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home/Home.vue'
import Login from '../views/Login/Login.vue'
import Detail from '../views/Detail/Detail.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/login',
  },
  {
    path: '/home',
    name: 'Home',
    component: Home,
    meta: {  //用来判断是否显示TabBar组件
      showTabBar: true
    }
  },
  {
    path: '/login',
    name: 'Login',
    meta:{
      roles:["admin","user"]
    },
    component: Login,
  },
  {
    path: '/detail/:id',
    name: 'Detail',
    component: Detail,
  },
  {
    path: '/mine',
    name: 'Mine',
    component: () => import('../views/Mine/Mine.vue'),
    meta: { 
    showTabBar: true
   }
  },
  {
    path: '/collect',
    name: 'Collect',
    component: () => import('../views/Collect/Collect.vue'),
    meta: {  //用来判断是否显示TabBar组件
      showTabBar: true
    }
  }
]

const router = new VueRouter({
  routes
})

export default router
